<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

// Route::get('/', function () {
//     return view('welcome');
// });

Route::get('/home/layout', 'home\IndexController@layout');
Route::get('/', 'home\IndexController@index');
Route::get('/catelist/{id}', 'home\IndexController@catelist');

Route::group(['middleware' => 'login'], function(){
		//分类管理
		Route::get('/admin/cate/menu', 'Admin\CateAscController@menucate');
		//ajax排序
		Route::post('/admin/cate/menupx', 'Admin\CateAscController@menupx');

		Route::get('/admin/cate/nav', 'Admin\CateAscController@navcate');
		// ajax 排序
		Route::post('/admin/cate/navpx', 'Admin\CateAscController@navpx');
		Route::resource('/admin/cate', 'Admin\CateController');
			//后台主页
		Route::get('/admin/index', 'admin\IndexController@index');
		//数据统计
		Route::post('/admin/index/userajax', 'admin\IndexController@userajax');
		//动态评论
		Route::post('/admin/index/comajax', 'admin\IndexController@comajax');
		//用户管理
		Route::get('/admin/user/add', 'admin\UserController@add');
		Route::post('/admin/user/insert', 'admin\UserController@insert');
		Route::get('/admin/user/index', 'admin\UserController@index');
		Route::post('/admin/user/ajaxUpdate', 'admin\UserController@ajaxUpdate');
		Route::post('/admin/user/ajaxName', 'admin\UserController@ajaxName');
		Route::get('/admin/user/edit/{id}', 'admin\UserController@edit');
		Route::post('/admin/user/update', 'admin\UserController@update');
		Route::get('/admin/user/delete/{id}', 'admin\UserController@delete');
		Route::get('/admin/user/details/{id}', 'admin\UserController@details');
		//管理员用户
		Route::get('/admin/user/admin', 'admin\UserController@admin');
		Route::get('/admin/user/edit_admin/{id}', 'admin\UserController@edit_admin');
		Route::post('/admin/user/update_admin', 'admin\UserController@update_admin');
		//后台工作账号
		Route::get('/admin/user/back', 'admin\UserController@back');
		Route::get('/admin/user/edit_back/{id}', 'admin\UserController@edit_back');
		Route::post('/admin/user/update_back', 'admin\UserController@update_back');
		Route::get('/admin/user/delete_back/{id}', 'admin\UserController@delete_back');

		
		//商品管理
		Route::controller('/admin/goods', 'admin\GoodsController');

		//轮播图管理
		Route::get('/admin/bigpic', 'Admin\BigPicController@index');
		Route::post('/admin/bigpic/addfirst', 'Admin\BigPicController@addfirst');
		Route::post('/admin/bigpic/addsecond', 'Admin\BigPicController@addsecond');
		Route::post('/admin/bigpic/addthird', 'Admin\BigPicController@addthird');
		Route::post('/admin/bigpic/addfourth', 'Admin\BigPicController@addfourth');
		


		// 图片管理
		Route::get('/admin/picture', 'Admin\PictureController@index');
		//广告位
		Route::get('/admin/ad', 'Admin\AdController@index');
		Route::post('/admin/ad/add', 'Admin\AdController@add');

		//link
		Route::get('/admin/link/add','Admin\LinkController@add'); 
		Route::post('/admin/link/insert','Admin\LinkController@insert');
		Route::get('/admin/link/index','Admin\LinkController@index'); 
		Route::get('/admin/link/edit/{id}','Admin\LinkController@edit');
		Route::post('/admin/link/update','Admin\LinkController@update');
		Route::get('/admin/link/delete/{id}','Admin\LinkController@delete');

		//word
		Route::get('/admin/word/add','Admin\WordController@add'); 
		Route::post('/admin/word/insert','Admin\WordController@insert');
		Route::get('/admin/word/index','Admin\WordController@index'); 
		Route::get('/admin/word/edit/{id}','Admin\WordController@edit');
		Route::post('/admin/word/update','Admin\WordController@update');
		Route::get('/admin/word/delete/{id}','Admin\WordController@delete');

		//退出
		Route::get('/admin/logout', 'Admin\LoginController@logout');

		

});

//前台中间件
Route::group(['middleware' => 'home_login'], function(){
		//个人中心-我的动态
		Route::get('/home/user_trend', function(){
			return view('home.user.user_trend');
		});
		// 个人设置
		Route::get('/home/user_set', 'Home\UserController@user_set');
		Route::post('/home/user_set/update', 'Home\UserController@update');
		Route::get('/home/user_set/logout', 'Home\UserController@logout');
		Route::get('/home/layout/logout', 'Home\UserController@layoutlogout');

		//消息中心
		Route::get('/home/user_news', function(){
			return view('home.user.user_news');
		});
		//我的收藏
		Route::get('/home/user_collect', function(){
			return view('home.user.user_collect');
		});
});

//登录
Route::get('/admin/login', 'Admin\LoginController@login');
Route::post('/admin/dologin', 'Admin\LoginController@dologin');

// 验证码
Route::get('kit/captcha/{tmp}', 'Admin\KitController@captcha');


//前台home
//登录注册
Route::get('/home/login', 'Home\LoginController@login');
Route::post('/home/dologin', 'Home\LoginController@dologin');

//注册
Route::get('/home/register', 'Home\LoginController@register');
Route::post('/home/doregister', 'Home\LoginController@doregister');

//找回密码
Route::get('/home/forget', 'Home\ForgetController@forget');
Route::post('/home/doforget', 'Home\ForgetController@doforget');
Route::get('/home/inputpass/{id}/token/{token}', 'Home\ForgetController@inputpass');
Route::post('/home/inputpass/update', 'Home\ForgetController@update');